from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import (
    CommunityViewSet, OwnerViewSet, MaintenanceViewSet,
    AnnouncementViewSet, SystemSettingViewSet, AuthViewSet
)

# 创建路由器并注册视图集
router = DefaultRouter()
router.register(r'communities', CommunityViewSet, basename='community')
router.register(r'owners', OwnerViewSet, basename='owner')
router.register(r'maintenances', MaintenanceViewSet, basename='maintenance')
router.register(r'announcements', AnnouncementViewSet, basename='announcement')
router.register(r'system-settings', SystemSettingViewSet, basename='system-setting')
router.register(r'auth', AuthViewSet, basename='auth')

# 定义应用级别的URL模式
urlpatterns = [
    path('', include(router.urls)),
]